<?php 
    class Message extends CI_Controller {



        public function index()
        {
            $this->load->view('home/message');
        }


        public function save()
        {
            $this->load->helper('common_function');
            $this->load->model('admin/Message_model');
            $title = $this->input->post('title',true); 
            $appellation = $this->input->post('appellation',true); 
            $email = $this->input->post('email',true); 
            $profile = $this->input->post('profile',true); 
            $phone = $this->input->post('phone',true); 
            $body = $this->input->post('body',true); 
            $ip = $this->input->ip_address(); 
            $state =0; 
            $createtime=time();


            if(empty($title)||empty($body))
            {
                ShowMsg('请输入完整信息!', -1,0,1000);
                exit;  

            }
            
            $data = array(
                'title' => $title ,
                'appellation' => $appellation,
                'email' => $email,
                'profile' => $profile,
                'phone' => $phone,
                'body' => $body,
                'ip' =>  $ip,
                'state' => $state,
                'createtime' => $createtime
            );
            $this->Message_model->message_save_add($data);
            ShowMsg('添加成功!', 'home/message',0,1000);
            exit; 

        }

    }
?>